<!--
 * @Descripttion: 
 * @Author: zhaozheng
 * @Version: 0.0.1
 * @Date: 2022-09-28 13:19:07
 * @LastEditors: zhaozheng
 * @LastEditTime: 2025-01-02 15:00:37
-->
<template>
  <div class="img"></div>
  <img src="@/assets/images/light_0.png" alt="">
  <h1>{{ title }}</h1>
  <van-button type="primary" size="mini" @click="handleClick">button</van-button>
</template>
<script setup lang="ts">
import { showToast, showDialog } from 'vant';
import { getClickNumbers } from "@/api/api";

const handleClick = () => {
  showToast({
    message: '点击了按钮',
    duration: 1000,
    forbidClick: true
  });
}

withDefaults(defineProps<{
  title?: string // 是否必传
}>(), {
  title: 'h5-simple-vue3' //默认值
})
let count = ref(0);

onMounted(() => {
  getClickNumbers().then((res: any) => {
    try {
      const { code, data } = res
      if (code === 0) console.log(data.click_num)
    } catch (error) {
      console.log(error);
    }
  }).catch((err) => {
    console.log(err);
  });
})
</script>
<style scoped>
.button {
  width: 375px;
  height: 100px;
  background-color: #ccc;
  cursor: pointer;
  border: none;
  margin-top: 20px;
}

.img {
  width: 120px;
  height: 120px;
  background: url("@/assets/images/light_0.png") no-repeat;
}
</style>
